package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;
import com.lmx.repoDomain.tmodel.business.User;//huibati
import javax.persistence.*;

/**
 * 账户表
 */
@Entity
@Table(name = "ccd_account")
@JsonApiResource(type = "account")
public class Account extends BaseEntity {
	private String code; // 编码
	private User user;//用户
	private Double balance;//余额
	private Short status;//账户状态
	private Double withdrawDeposit;//总提现金额
	private Double recharge;//总充值金额
	private Double income;// 总收入金额
	private Double spending;// 支出金额
	private Short bindType;//绑定类型  1：微信 2：支付宝 3：银行卡
	private String winxin;//微信
	private String zhifubao;//支付宝
	private String cardNumber;//银行卡号
	private Double callCost;//通话费用
	private Double freezingAmount;//任务未结算，冻结金额
	private Integer createTime;//创建时间
	private Integer updateTime;//更新时间
	private String remark;//备注

	@Column(name = "code")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "user_id",foreignKey = @ForeignKey(name = "null"))
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "balance")
	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		if(balance == null){
			balance = 0.0;
		}
		this.balance = balance;
	}

	@Column(name = "status")
	public Short getStatus() {
		return status;
	}

	public void setStatus(Short status) {
		this.status = status;
	}

	@Column(name = "withdraw_deposit")
	public Double getWithdrawDeposit() {
		return withdrawDeposit;
	}

	public void setWithdrawDeposit(Double withdrawDeposit) {
		if(withdrawDeposit == null){
			withdrawDeposit = 0.0;
		}
		this.withdrawDeposit = withdrawDeposit;
	}

	@Column(name = "recharge")
	public Double getRecharge() {
		if(recharge == null){
			recharge = 0.0;
		}
		return recharge;
	}

	public void setRecharge(Double recharge) {
		this.recharge = recharge;
	}

	@Column(name = "income")
	public Double getIncome() {
		return income;
	}

	public void setIncome(Double income) {
		if(income == null){
			income = 0.0;
		}
		this.income = income;
	}

	@Column(name = "spending")
	public Double getSpending() {
		return spending;
	}

	public void setSpending(Double spending) {
		if(spending == null){
			spending = 0.0;
		}
		this.spending = spending;
	}

	@Column(name = "bind_type")
	public Short getBindType() {
		return bindType;
	}

	public void setBindType(Short bindType) {
		this.bindType = bindType;
	}

	@Column(name = "weixin")
	public String getWinxin() {
		return winxin;
	}

	public void setWinxin(String winxin) {
		this.winxin = winxin;
	}

	@Column(name = "zhifubao")
	public String getZhifubao() {
		return zhifubao;
	}

	public void setZhifubao(String zhifubao) {
		this.zhifubao = zhifubao;
	}

	@Column(name = "card_number")
	public String getCardNumber() {
		return cardNumber;
	}

	public void setCardNumber(String cardNumber) {
		this.cardNumber = cardNumber;
	}

	@Column(name = "call_cost")
	public Double getCallCost() {
		return callCost;
	}

	public void setCallCost(Double callCost) {
		if(callCost == null){
			callCost = 0.0;
		}
		this.callCost = callCost;
	}

	@Column(name = "freezing_amount")
	public Double getFreezingAmount() {
		return freezingAmount;
	}

	public void setFreezingAmount(Double freezingAmount) {
		if(freezingAmount == null){
			freezingAmount = 0.0;
		}
		this.freezingAmount = freezingAmount;
	}

	@Column(name = "create_time")
	public Integer getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Integer createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_time")
	public Integer getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Integer updateTime) {
		this.updateTime = updateTime;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
}
